const areaModel = {
  checkByUsername: 'select * from planting_area where username = ?',
  // list: 'select * from planting_area order by sort desc, created_at desc LIMIT 10 OFFSET 0', // 
  list: 'SELECT planting_area.*, GROUP_CONCAT(planting_area_tree.planting_tree_id) AS planting_area_tree_id_array FROM planting_area LEFT JOIN planting_area_tree ON planting_area.id = planting_area_tree.planting_area_id GROUP BY planting_area.id ORDER BY planting_area.sort DESC, planting_area.created_at DESC LIMIT 10 OFFSET 0',
  areaNumber: 'select * from planting_area_tree order by sort desc, created_at desc LIMIT 10 OFFSET 0', // 
  paramsList: 'select * from planting_area', // 
  // list: 'select * from system_item_setting order by sort asc', //升序
  add: 'insert into planting_area set ?',
  delete: 'delete from planting_area where id=?',
  update: 'update planting_area set ? where id=?',
  useTreeList: 'select * from planting_area_tree where planting_area_id = ?',
  addUserTreeList: 'insert into planting_area_tree where planting_tree_id = ?',
  updateUseTree: 'update planting_area_tree set ? where id=?'
}

module.exports = areaModel
